package com.mark.killy.Utils;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import com.mark.killy.R;
import com.mark.killy.AttentionFragment;
import com.mark.killy.DiscoveryFragment;
import com.mark.killy.HomeFragment;
import com.mark.killy.ProfileFragment;

public class DataGenerator {

    //点击前的效果
    public static final int []mTabRes = new int[]{R.drawable.ic_home_main, R.drawable.ic_logo_community,R.drawable.ic_logo_messages,R.drawable.ic_logo_myhome};
    //点击后的效果
    public static final int []mTabResPressed = new int[]{R.drawable.ic_home_main_zero,R.drawable.ic_logo_community_zero,R.drawable.ic_logo_messages_zero,R.drawable.ic_logo_myhome_zero};
    //底部显示文字内容
    public static final String []mTabTitle = new String[]{"首页","社区","消息","我的"};


    public static Fragment[] getFragments(String from){
        Fragment fragments[] = new Fragment[4];
        fragments[0] = HomeFragment.newInstance(from);
        fragments[1] = DiscoveryFragment.newInstance(from);
        fragments[2] = AttentionFragment.newInstance(from);
        fragments[3] = ProfileFragment.newInstance(from);
        return fragments;
    }

    /**
     * 获取Tab 显示的内容
     * @param context
     * @param position
     * @return
     */
    public static View getTabView(Context context, int position){
        View view = LayoutInflater.from(context).inflate(R.layout.activity_tab_home_centent,null);
        ImageView tabIcon = (ImageView) view.findViewById(R.id.tab_content_image);
        tabIcon.setImageResource(DataGenerator.mTabRes[position]);
        TextView tabText = (TextView) view.findViewById(R.id.tab_content_text);
        tabText.setText(mTabTitle[position]);
        return view;
    }
}
